
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>常见的JVM调优参数 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>常见的JVM调优参数 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在JVM中，用于设置初始堆内存和最大堆内存的参数分别是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">设置JVM启动时的初始堆内存使用 `-Xms<size>`，而设置最大堆内存则使用 `-Xmx<size>`。</div>
          </div>
          <div class="card-source">来源: 1. 堆内存设置</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">G1垃圾回收器（G1GC）主要适用于哪些应用场景？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">G1垃圾回收器适用于大堆内存和对低延迟有要求的应用程序。</div>
          </div>
          <div class="card-source">来源: 2. 垃圾回收器选择</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">Parallel垃圾回收器因其特性也被称为什么？启用它的JVM参数是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Parallel垃圾回收器也称为“吞吐量优先”回收器，可以通过 `-XX:+UseParallelGC` 参数来启用。</div>
          </div>
          <div class="card-source">来源: 2. 垃圾回收器选择</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">参数 `-XX:NewRatio=2` 对JVM堆内存的年轻代和老年代的比例有何影响？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">该设置将使年轻代的大小被设置为老年代大小的1/2。</div>
          </div>
          <div class="card-source">来源: 3. 垃圾回收调优</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">如何为G1垃圾回收器设定一个明确的最大停顿时间目标，例如200毫秒？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可以使用 `-XX:MaxGCPauseMillis=<time>` 参数来设定目标，例如 `-XX:MaxGCPauseMillis=200`。</div>
          </div>
          <div class="card-source">来源: 3. 垃圾回收调优</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">如何配置JVM，使其将详细的垃圾回收日志输出到指定文件，例如 `/path/to/gc.log`？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可以通过组合使用 `-XX:+PrintGCDetails` 参数以输出详细信息，并使用 `-Xloggc:/path/to/gc.log` 参数来指定日志文件。</div>
          </div>
          <div class="card-source">来源: 4. 垃圾回收日志</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">从JDK 8开始，用于存储类元数据的永久代（Permanent Generation）被什么区域取代了？配置其大小的相关参数是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">从JDK 8及以后版本开始，永久代被Metaspace取代。配置其大小的参数是 `-XX:MetaspaceSize` (初始大小) 和 `-XX:MaxMetaspaceSize` (最大大小)。</div>
          </div>
          <div class="card-source">来源: 6. 类加载器设置</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">什么是字符串去重（String Deduplication），它与哪个垃圾回收器相关联？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">字符串去重是G1垃圾回收器的一个特性，可以通过 `-XX:+UseStringDeduplication` 参数启用，用于减少内存占用。</div>
          </div>
          <div class="card-source">来源: 7. 其他调优参数</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">`-XX:+DisableExplicitGC` 参数的具体作用是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">该参数的作用是禁用通过代码调用 `System.gc()` 而触发的显式垃圾回收。</div>
          </div>
          <div class="card-source">来源: 7. 其他调优参数</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
